#include <stdio.h>
#include <string.h>

int main(int argc, char *argv[])
{
	char s[1024];
	int n, i, j, cnt, len, end_flg;

	scanf("%s", s);
	scanf("%d", &n);

	len = strlen(s);

    cnt = 0;
    while (cnt < n) {
        end_flg = 1;
        for (i=0; i<len-1; i++) {
            if (s[i] > s[i+1]) {
                for (j=i; j<len-1; j++) s[j] = s[j+1];
                len--;
                cnt++;
                end_flg = 0;
                break;
            }
        }
        if (end_flg == 1) break;
    }

    if (cnt < n) len = len - (n-cnt);
    s[len] = '\0';
    printf("%s\n", s);

	return 0;
}
